package com.cgs.query.demo

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import springfox.documentation.builders.PathSelectors
import springfox.documentation.builders.RequestHandlerSelectors
import springfox.documentation.service.ApiInfo
import springfox.documentation.spi.DocumentationType
import springfox.documentation.spring.web.plugins.Docket
import springfox.documentation.swagger2.annotations.EnableSwagger2
import io.swagger.annotations.Api
import springfox.documentation.builders.ApiInfoBuilder

@Configuration
@EnableSwagger2
open class SwaggerConfig {
	@Bean
	open fun api(): Docket {
		return Docket(DocumentationType.SWAGGER_2).apiInfo(getApiInfo()).useDefaultResponseMessages(false)
				.forCodeGeneration(false).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
				.paths(PathSelectors.regex("/.*"))
				.build()
	}

	private fun getApiInfo(): ApiInfo {
		return ApiInfoBuilder().title("quert-center-API").description("查询定义模块").version("1.0-SNAPSHOT").build()
	}

}
